package com.atguigu.mall.weball.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.feign.product.CategoryFeign;
import com.atguigu.gmall.product.vo.CategoryTreeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

@Controller
public class indexController {
    @Autowired
    CategoryFeign categoryFeign;
    @GetMapping("/")
    public String index(Model model) {
        Result<List<CategoryTreeVo>> categorys = categoryFeign.getCategoryTree();
        List<CategoryTreeVo> data = categorys.getData();
        model.addAttribute("list",data);
        return "index/index";
    }
}
